package com.accompany.fragment.my.fragment;

import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.RecyclerView;

import com.accompany.R;
import com.accompany.adapter.BaseRecyclerHolder;
import com.accompany.adapter.BaseRecyclerRefreshAdapter;
import com.accompany.base.BaseFragment;
import com.accompany.view.RecyclerViewLayoutManager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 信息说明: 培训中心线上
 * company: 兰州丰荣信息科技有限公司
 * 创建时间: on 2022/3/17 16 ：39
 * 项目名称：yuanban
 */
public class TrainingCenterOnlineFragment extends BaseFragment {
    @BindView(R.id.recycler_kecheng)
    RecyclerView mRecyclerViewTuijian;
    @BindView(R.id.recycler_remen)
    RecyclerView mRecyclerViewRemen;

    @Override
    public int getLayoutResource() {
        return R.layout.fragment_online_view;
    }

    @Override
    public void initLayoutView() {
        RecyclerViewLayoutManager.setLinearHorizontalManager(getActivity(), mRecyclerViewTuijian);
        RecyclerViewLayoutManager.setGridLayoutManager(getActivity(), mRecyclerViewRemen, 2);
        List<String> mlist = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            mlist.add("");
        }
        mRecyclerViewTuijian.setAdapter(new BaseRecyclerRefreshAdapter<String>(getActivity(), mlist, R.layout.tuijian_peixun_kecheng) {
            @Override
            public void convert(BaseRecyclerHolder holder, String item, int position, boolean isScrolling) throws IOException {
                ImageView imageView = holder.getView(R.id.icon_tuijian);
                RoundedCorners roundedCorners = new RoundedCorners(5);
                RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
                Glide.with(getActivity())
                        .load(R.mipmap.rm_bg)
                        .apply(options)
                        .into(imageView);
            }
        });
        mRecyclerViewRemen.setAdapter(new BaseRecyclerRefreshAdapter<String>(getActivity(), mlist, R.layout.remen_peixun_kecheng) {
            @Override
            public void convert(BaseRecyclerHolder holder, String item, int position, boolean isScrolling) throws IOException {
                ImageView imageView = holder.getView(R.id.icon_remen);
                holder.getView(R.id.msg_title).getBackground().setAlpha(50);
                RoundedCorners roundedCorners = new RoundedCorners(5);
                RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
                Glide.with(getActivity())
                        .load(R.mipmap.rm_bg)
                        .apply(options)
                        .into(imageView);
            }
        });
    }
    @OnClick({R.id.linear_course})
    public void OnClick(View view){
        switch (view.getId()){
            case R.id.linear_course:

                break;
        }
    }
}
